﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="EditReferences.ascx.cs"
    Inherits="blackhouse.WebNemo.Web.Controls.EditReferences" %>

<%@Register Src="Records.ascx" TagName="Records" TagPrefix="nemo" %>

<script language="javascript" type="text/javascript">
    $(function () {
        $('.bnt-save').click(function (e) {
            e.preventDefault();
            var $selecteds = $('input[name=selected-record]:checked').map(function () {
                var $o = new Object();
                var $parent = $(this).parent().parent();
                $o.Id = parseInt($parent.find('.field-id').text().trim());
                $o.Identyficator = $parent.find('.field-identyficator').text().trim();
                $o.Url = $parent.find('.ui-prev').attr('href');

                return $o;
            });

            var $groupId = parseInt($('#hidWrapGroup').val());

            if (window.parent.SetReferences)
                window.parent.SetReferences($groupId, $selecteds);

        });

    });
</script>
<table class="record-top" cellpadding="0" cellspacing="0">
    <tr>
        <td class="record-top-id">
            Id rekordu:<br />
            <span class="record-top-value">
                <asp:Literal runat="server" ID="ltlIdx"> - </asp:Literal></span>
        </td>
        <td class="record-top-identyfikator">
            Identyfikator rekordu edytowanego:<br />
            <span class="record-top-value">
                <asp:Literal runat="server" ID="ltlBaseIdentyficator"> - </asp:Literal></span>
        </td>
        <td class="record-top-times">
            Edytowana kolumna:<br />
            <span class="record-top-value">
                <asp:Literal runat="server" ID="ltlBaseColumn"> - </asp:Literal></span>
        </td>
        <td class="record-top-actions">
            <a class="blue-bnt bnt-half rectop-ae bnt-save" title="Przenieś referencje do formularza edycji rekordu">zapisz</a>
        </td>
    </tr>
</table>
<div class="record-display">
    <asp:Panel runat="server" ID="pnlSelected">
        <h2>
            <asp:Literal runat="server" ID="ltlSelected">
             Wybrane pozycje</asp:Literal></h2>
        <nemo:Records ID="recSelected" runat="server" AllChecked="true" />
    </asp:Panel>
    <asp:Panel runat="server" ID="pnlNonSelected">
        <h2>
            Pozostałe pozycje</h2>
        <nemo:Records ID="recNonSelected" runat="server" />
    </asp:Panel>
</div>
<asp:HiddenField runat="server" ID="hidWrapGroup" ClientIDMode="Static" />
